/*
 * @(#) $Header$
 *
 * Copyright (C) 2007  Forklabs Daniel Léonard
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package ca.forklabs.media.jai.opimage;

import java.awt.RenderingHints;
import java.awt.image.renderable.ParameterBlock;
import java.util.Collection;
import javax.media.jai.CollectionImage;
import javax.media.jai.CollectionImageFactory;
import javax.media.jai.CollectionOp;
import javax.media.jai.RenderableCollectionImageFactory;
import ca.forklabs.media.jai.SimpleCollectionImage;

/**
 * Class {@code PeriodicShift3DRCIF} is a {@link CollectionImageFactory} and a
 * {@link RenderableCollectionImageFactory} supporting the
 * <em>periodicshift3d</em> operation.
 *
 * @author   <a href="mailto:forklabs at gmail.com?subject=ca.forklabs.media.jai.opimage.PeriodicShift3DRCIF">Daniel Léonard</a>
 * @version $Revision$
 */
public class PipelineRCIF implements CollectionImageFactory, RenderableCollectionImageFactory {

//---------------------------
// Constructor
//---------------------------

   /**
    * Constructor.
    */
   public PipelineRCIF() {
   // nothing
      }


//---------------------------
// Implemented methods from javax.media.jai.CollectionImageFactory
//---------------------------

   /**
    * Performs the collection pipeline.
    * @param   pb   the parameter block.
    * @param   hints   optional rendering hints.
    * @return   the result.
    */
   public CollectionImage create(ParameterBlock pb, RenderingHints hints) {
      PipelineUtil.Specialization<Collection<?>> specialization = PipelineUtil.COLLECTION;
      Collection<?> collection = PipelineUtil.doPipeline(pb, hints, specialization);
      CollectionImage sink = new SimpleCollectionImage(collection);
      return sink;
      }

   /**
    * It is impratical to perform the update.
    * @param old_pb   ignored
    * @param old_hints   ignored
    * @param new_pb   ignored
    * @param new_hints   ignored
    * @param old_image   ignored
    * @param op   ignored
    * @return always {@code null}.
    */
   public CollectionImage update(ParameterBlock old_pb, RenderingHints old_hints,
                                 ParameterBlock new_pb, RenderingHints new_hints,
                                 CollectionImage old_image,
                                 CollectionOp op) {
   // it is impracticable to perform the update
      CollectionImage new_image = null;
      return new_image;
      }


//---------------------------
// Implemented methods from javax.media.jai.RenderableCollectionImageFactory
//---------------------------

   /**
    * Performs the renderable collection pipeline.
    * @param   pb   the parameter block.
    * @return   the result.
    */
   @Override
   public CollectionImage create(ParameterBlock pb) {
      RenderingHints hints = null;
      PipelineUtil.Specialization<Collection<?>> specialization = PipelineUtil.RENDERABLE_COLLECTION;
      Collection<?> collection = PipelineUtil.doPipeline(pb, hints, specialization);
      CollectionImage sink = new SimpleCollectionImage(collection);
      return sink;
      }

   }
